package com.itheima.demo;

import java.util.Arrays;

public class Test04 {
    public static void main(String[] args) {
        //需求：把一个数组复制到另一个数组

        //1.定义原数组
        int[] arr = {1, 23, 5, 4, 15};

        //2.定义新数组,并设置长度
        int[] newArr = new int[arr.length];

        for (int i = 0; i < arr.length; i++) {
            newArr[i] = arr[i];
        }

        System.out.println(Arrays.toString(newArr));

    }
}
